home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / logbatch / login.mnu < prev    next >
Text File  |  1990-11-14  |  13KB  |  544 lines

  1. Comment
  2. ========================================================
  3.  
  4. Copyright 1990 by Marc Perkel * All right reserved.
  5.  
  6. Requires MarxMenu version 2.14 or later to run.
  7.  
  8. MarxMenu now allows you to login to a Novell network without using
  9. Novell's login program or messing with nasty login scripts. You can
  10. be in MarxMenu all the way in.
  11.  
  12. Logging into Novell is tricky. Especially if you are using boot roms
  13. on your network cards. Through much trial and error, I have found
  14. some solid tricks that make life easier.
  15.  
  16. You should have the following two BATCH files in your LOGIN
  17. directory as follows:
  18.  
  19. LOADNET.BAT
  20. -----------
  21. NET4
  22. F:
  23. STARTUP
  24.  
  25. STARTUP.BAT
  26. -----------
  27. SET BOOTUP=LOGIN
  28. MarxMenu Login
  29. %BOOTUP%
  30.  
  31. Each workstation should have their own AUTOEXEC.BAT. The last line
  32. should be LOADNET. If you are running multiple versions of dos you
  33. can have the first line of LOADNET.BAT be %NET%. You will then have
  34. to have SET NET=NET4 in your AUTOEXEC.BAT file.
  35.  
  36. Also, if you want automatic login you can add the following lines:
  37.  
  38. SET USERNAME=MARC   Your Name Here
  39. SET PASSWORD=NERD   Your Password Here
  40.  
  41. You should also change the COMSPEC= to the network command.com BEFORE
  42. you run NET4. For some unknown reason, this solves a lot of problems.
  43.  
  44. Example:
  45.  
  46. IPX
  47. SET COMSPEC=Y:COMMAMD.COM
  48. NET4
  49.  
  50. Another boot rom quirk is that you can't run any program off a boot
  51. rom that trashes upper memory. An example is running QEMM on a
  52. monochrome monitor.
  53.  
  54. By using this method the boot disk or boot rom hands control over in
  55. a clean way. LOADNET.BAT then branches to STARTUP.BAT for the rest
  56. of the login sequence.
  57.  
  58. For some strange reason which I can't explain, LOADNET and STARTUP
  59. have to be two separate batch files. I think it forces the transient
  60. part of COMMAND.COM to load into memory. Anyhow, don't combine these
  61. into one batch file
  62.  
  63. The first line of STARTUP.BAT is a message that tells this menu that
  64. the user is logging in for the first time. This menu creates a batch
  65. file and puts the name of it in the environment variable BOOTUP.
  66. STARTUP.BAT then executes this file.
  67.  
  68. This is the example for MY network. You'll have to modify it for
  69. yours.
  70.  
  71. One word of caution. After modifing this menu, always run MARXCOMP
  72. LOGIN to compile it. Otherwise, if you boot up into it you won't
  73. have enough access rights to recompile automatically.
  74.  
  75. ========================================================
  76. EndComment
  77.  
  78. var
  79.    UserName
  80.    PassW
  81.    Logged
  82.    Station
  83.    NetAddress
  84.    SmartDir
  85.    MyServer
  86.    Servers
  87.    HomeDir
  88.    DosDir
  89.    BatFile
  90.    BatName
  91.    FancyScreen
  92.  
  93. ;----- All environment string access will be the Master Environment
  94.  
  95. MasterEnvironment
  96.  
  97. Comment
  98. ========================================================
  99.  
  100. If Environment variables USERNAME and PASSWORD are set, this menu
  101. will attempt to log into the network using these values. This allows
  102. for automatic login. You can also pass the parameters on the command
  103. line as follows.
  104.  
  105. MarxMenu Login <Name> <Password>
  106.  
  107. The name may contain a referrence to a server: Server/Name
  108.  
  109. ========================================================
  110. EndComment
  111.  
  112. ;------ If CapsLock key is on then override default login
  113.  
  114. Logged = False
  115. if not CapsLock
  116.    UserName = ParamStr(2)
  117.    if UserName = '' then UserName = ReadEnv('USERNAME')
  118.    if UserName > ''
  119.       PassW = ParamStr(3)
  120.       if PassW = '' then PassW = ReadEnv('PASSWORD')
  121.       if PassW > ''
  122.          NovLogin (UserName,PassW)
  123.          Logged = NovResult = 0
  124.       endif
  125.    endif
  126. endif
  127.  
  128. MyServer = NovDefaultServer
  129. NovServers(Servers)
  130.  
  131. ;------ Fills station to 3 digits. Example: 004
  132.  
  133. Station  = Str(NovConnection)
  134. while length(Station) < 3
  135.    Station = '0' + Station
  136. endwhile
  137.  
  138. ;------ Read network address
  139.  
  140. NetAddress = NovStationAddress (NovConnection)
  141.  
  142. ;------ Select colors and prepare screen
  143.  
  144. if not Logged
  145.    FancyScreen = True
  146.    if ColorScreen
  147.       TextColor White Red
  148.       BoxBorderColor Green Brown
  149.       BoxInsideColor Black Brown
  150.       ClearScreen 176
  151.       ClockColor Black Brown
  152.       TextColor Black Green
  153.       BoxHeaderColor Yellow Mag
  154.       Shadow
  155.    else
  156.       TextColor Grey Black
  157.       ClearScreen 176
  158.       TextColor Black Grey
  159.       BoxBorderColor Black Grey
  160.       BoxInsideColor Black Grey
  161.       BoxHeaderColor Black Grey
  162.       ClockColor Black Grey
  163.    endif
  164.    BlankMessage = 'Netware Login'
  165.    ClockMode = 262
  166.    GotoXY 1 25
  167.    ClearLine
  168.    WriteCenter "Computer Tyme Master Network Login Menu"
  169.    SingleLineBox
  170.    Explode Off
  171.    ShadowColor Grey Red
  172.    if ColorScreen
  173.       DrawBox 3 2 74 5
  174.       ClockPos 42 5
  175.       TextColor Blue Brown
  176.    else
  177.       DrawBox 3 2 76 5
  178.       ClockPos 44 5
  179.    endif
  180.    WriteCenter 'Computer Tyme Software Development Laboratory'
  181.    Writeln
  182.    TextColor Black Brown
  183.    WriteCenter '───────────────────────────────────────────────────────'
  184.    Writeln
  185.    TextColor Black Brown
  186.    Write "  (C) 1990 by Marc Perkel"
  187.    DoubleLineBox
  188.    BlankTime = 10
  189.  
  190.    Explode On
  191.    BlockBox
  192.    BoxBorderColor Green Blue
  193.    BoxInsideColor Yellow Blue
  194.    BoxHeader = " Station Information "
  195.    if ColorScreen
  196.       DrawBox 39 17 38 6
  197.       TextColor Yellow Blue
  198.    else
  199.       DrawBox 41 17 38 6
  200.       TextColor Grey Black
  201.    endif
  202.  
  203.    Writeln '           Server: ' MyServer
  204.    Writeln '          Network: ' NetAddress
  205.    Writeln '       Connection: ' Station
  206.    Write   '      DOS Version: ' DosVersionString
  207.  
  208.    BoxHeader = ' Logging into Server * ' + MyServer + ' '
  209.    DrawBox 3 10 50 4
  210. endif
  211.  
  212. Security
  213.  
  214. while not Logged
  215.    if UserName = ''
  216.       ClearScreen
  217.       Write ' Login Name: '
  218.       UserName = UpperCase(Readln)
  219.       Writeln
  220.       if UserName = 'EXIT' then ExitMenu
  221.    endif
  222.    if not Logged
  223.       Write '   Password: '
  224.       PassW = Readln
  225.       NovLogin (UserName,PassW)
  226.       Logged = NovResult = 0
  227.    endif
  228.    if not Logged then UserName = ''
  229. endwhile
  230.  
  231. if FancyScreen
  232.    EraseTopWindow
  233.    EraseTopWindow
  234.    EraseTopWindow
  235.    EraseTopWindow
  236.    TextColor Grey Black
  237.    ClearScreen
  238. endif
  239.  
  240. UserName = NovMyLoginName
  241.  
  242. Comment
  243. ========================================================
  244.  
  245. Here we set a different directory for a program depending on if we
  246. have a color or monochrome monitor.
  247.  
  248. ========================================================
  249. EndComment
  250.  
  251. if VideoMode = Mono
  252.    SmartDir = 'F:\PUBLIC\MSMART'
  253. else
  254.    SmartDir = 'F:\PUBLIC\CSMART'
  255. endif
  256.  
  257. ;----- You can't assume that you have an F: drive unless you map it.
  258.  
  259. NovMapDrive ('F','SYS:\LOGIN')
  260.  
  261. ;----- Here we calculate a home directory for each user.
  262.  
  263. HomeDir = 'F:\HOME\' + UserName
  264. if UserName = 'SUPERVISOR' then HomeDir = 'F:\SYSTEM'
  265. if not ExistDir(HomeDir) then HomeDir = 'F:\PUBLIC\APPS'
  266.  
  267. Comment
  268. ========================================================
  269.  
  270. Here we calulate the the name of the dos directory that matches the
  271. version of dos we are running.
  272.  
  273. ========================================================
  274. EndComment
  275.  
  276. DosDir = 'F:\PUBLIC\DOSV' + DosVersionString
  277.  
  278. Comment
  279. ========================================================
  280.  
  281. Here's where we map our drives. This does not set the search path.
  282. You set that explicitly by writing to the PATH environment variable.
  283.  
  284. Drive map commands may contain server and volume referrences:
  285.  
  286. MovMapDrive('I','TYME/VOL1:SERVICE')
  287.  
  288. ========================================================
  289. EndComment
  290.  
  291. NovMapDrive ('Z',HomeDir)
  292. NovMapDrive ('Y','F:\PUBLIC\APPS')
  293. NovMapDrive ('X',DosDir)
  294. NovMapDrive ('W','F:\PUBLIC\UTIL')
  295. NovMapDrive ('P','F:\PUBLIC')
  296. NovMapDrive ('U','F:\SYSTEM')
  297. NovMapDrive ('L','F:\LOGIN')
  298. if MyServer = 'TYME'
  299.    NovMapDrive ('I','VOL1:')
  300. endif
  301. if (MyServer = 'TYME') or (MyServer = 'MARX')
  302.    NovMapDrive ('S',SmartDir)
  303. endif
  304.  
  305. ;Here's where we set master environment variable strings
  306.  
  307. SetEnv ('PASSWORD=')
  308. SetEnv ('NET=')
  309. SetEnv ('USERNAME=' + UserName)
  310. SetEnv ('STATION=' + Station)
  311. SetEnv ('COMSPEC=X:COMMAND.COM')
  312. SetEnv ('PROMPT=$e[1;33m$p: $e[0;32m')
  313. SetEnv ('PD.EXE=/$Z:PD.PIC')
  314. SetEnv ('MXCTL=/C')
  315. SetEnv ('MXECHO=OFF')
  316. if MyServer = 'MARX2'
  317.    SetEnv ('PATH=Z:.;Y:.;X:.;W:.;P:.;U:.;M:.;')
  318. else
  319.    SetEnv ('PATH=Z:.;Y:.;X:.;W:.;P:.;U:.;S:.;')
  320. endif
  321.  
  322. FixPath    ;Verifies all search paths exist
  323.  
  324. ChDir (HomeDir)
  325.  
  326. ;------ Opens a semaphore that XMETER can read.
  327.  
  328. NovOpenSemaphore ('XM-LOGIN',0)
  329.  
  330. ;------ LOGIN is set to BOOTUP if logging in for the first time
  331.  
  332. if UpperCase(ReadEnv('BOOTUP')) <> 'LOGIN' then ExitMenu
  333.  
  334. Comment
  335. ========================================================
  336.  
  337. In order to load TSRs, MarxMenu writes a temporary batch file and
  338. exits. The STARTUP.BAT file then jumps to this batch file.
  339.  
  340. ========================================================
  341. EndComment
  342.  
  343. ;------ Create temporary batch file for rest of login sequence
  344.  
  345. BatName = 'Z:$MRX' + Station + '.BAT'
  346. SetEnv ('BOOTUP=' + BATNAME)
  347. FileAssign(BatFile,BatName)
  348. FileCreate(BatFile)
  349.  
  350. if DosVersionString < '3.30'
  351.    WriteBat('ECHO OFF')
  352. else
  353.    WriteBat('@ECHO OFF')
  354. endif
  355. WriteBat ('SET BOOTUP=')
  356. WriteBat ('MARK > NUL')
  357.  
  358. ;----- Load Lan Assist
  359.  
  360. if NovInGroup ('LANASSIST')
  361.    WriteBat ('P:LA\LA +N >NUL')
  362. endif
  363.  
  364. ;----- Speed up keyboard;
  365.  
  366. WriteBat ('FASTKB 06')
  367.  
  368. Comment
  369. ================================================================
  370.  
  371. This next section deals with running special programs bases on the
  372. physical station number rather than by user. This deals with special
  373. hardware that needs software drivers loaded.
  374.  
  375. ================================================================
  376. EndComment
  377.  
  378. ;----- CD ROM Machine
  379.  
  380. ;if NetAddress = '255:2'
  381. ;   WriteBat ('CD\PUBLIC\MA')
  382. ;   WriteBat ('MSCDEX.EXE /D:MSCD003 /M:12')
  383. ;   WriteBat ('MAR C:\ RW=/ /C')
  384. ;endif
  385.  
  386. ;----- Vicki's Printer
  387.  
  388. if NetAddress = '255:65'
  389.    WriteBat('P:PA\PA P=1 M=200 T=10 Q1=TYME/VICKI')
  390.    Capture('VICKI',1)
  391. endif
  392.  
  393. ;----- Grace's Printer
  394.  
  395. if NetAddress = '255:68'
  396.    WriteBat('P:PA\PA P=1 M=200 T=10 Q1=TYME/GRACE')
  397.    Capture('GRACE',1)
  398. endif
  399.  
  400. ;----- Nita's Printer
  401.  
  402. if NetAddress = '255:E8'
  403.    WriteBat('P:PA\PA P=1 M=200 T=10 Q1=TYME/NITA')
  404.    Capture('NITA',1)
  405. endif
  406.  
  407. Comment
  408. ================================================================
  409.  
  410. This next section deals with running special programs bases on the
  411. users preferrences.
  412.  
  413. ================================================================
  414. EndComment
  415.  
  416. if UserName = 'MARC'
  417.    WriteBat('NUMOFF');
  418.    Capture('DOT',1)
  419.    Capture('LASER',2)
  420.    ChDir('TURBO5')
  421.    if MyServer = 'MARX'
  422.       SetEnv ('PATH=C:\TURBO5;C:\;' + ReadEnv('PATH'))
  423.       ChDir('C:\TURBO5')
  424.    endif
  425. endif
  426.  
  427. if UserName = 'VICKI'
  428.    WriteBat('NUMON');
  429.    Capture('LASER',2)
  430.    WriteBat('RETURN >NUL')
  431.    WriteBat('MAP ROOT C:=Z:')
  432.    WriteBat('MOUSE')
  433. endif
  434.  
  435. if UserName = 'KEVIN'
  436.    WriteBat('NUMON');
  437.    WriteBat('FASTKB 00')
  438.    Capture('LASER',1)
  439.    Capture('DOT',2)
  440.    SetEnv('PROMPT=[$p]')
  441.    ChDir('MARX')
  442. endif
  443.  
  444. if UserName = '386'
  445.    WriteBat('NUMOFF');
  446.    Capture('DOT',1)
  447.    Capture('LASER',2)
  448. endif
  449.  
  450. if UserName = 'TBBS'
  451.    Capture('DOT',1)
  452.    Capture('LASER',2)
  453.    ChDir('I:\BBS\TBBS')
  454.    SetEnv('D.EXE=/O/I')
  455.    WriteBat('DROPTO ' + BatName + ' R')
  456. endif
  457.  
  458. if UserName = 'GRACE'
  459.    WriteBat('NUMON');
  460.    Capture('LASER',2)
  461. endif
  462.  
  463. if UserName = 'NITA'
  464.    WriteBat('NUMON');
  465.    Capture('LASER',2)
  466. endif
  467.  
  468. if UserName = 'WORK'
  469.    WriteBat('NUMOFF');
  470.    Capture('DOT',1)
  471.    Capture('LASER',2)
  472. endif
  473.  
  474. ;----- Loads SideKick for all users in L:SIDEKICK.LST
  475.  
  476. ReadSideKickList
  477.  
  478. Comment
  479. ================================================================
  480.  
  481. The batch file ends by jumping to personal menu, if there is one, or
  482. the default menu if there isn't. DROPTO.BAT is used to erase the
  483. temporary batch file that this menu creates.
  484.  
  485. ================================================================
  486. EndComment
  487.  
  488. WriteBat ('DROPTO ' + BatName + ' MARX TYME')
  489.  
  490. FileClose(BatFile)
  491.  
  492. ExitMenu
  493.  
  494.  
  495. ;----- Procedure Definitions
  496.  
  497. Procedure WriteBat (BatLine)
  498.    FileWriteln(BatFile,BatLine)
  499. EndProc
  500.  
  501.  
  502. Procedure Pause
  503.    WriteBat ('PAUSE')
  504. EndProc
  505.  
  506.  
  507. Procedure Capture (Queue, PrinterPort)
  508. var PortSt
  509.    PortSt = Str(PrinterPort)
  510.    WriteBat ('P:CAPTURE Q=' + Queue + ' C=1 NB NFF TI=5 L=' + PortSt + '>NUL')
  511. EndProc
  512.  
  513. Comment
  514. ========================================================
  515.  
  516. A list is created in the \LOGIN directory containing the names of
  517. users who want to load sidekick. The name of the file is SIDEKICK.LST
  518. and looks like:
  519.  
  520. MARC
  521. VICKI
  522. GRACE
  523.  
  524. ========================================================
  525. EndComment
  526.  
  527. Procedure ReadSidekickList
  528. var SkList X Found
  529.    ReadTextFile ('L:SIDEKICK.LST',SkList)
  530.    X = 1
  531.    Found = False
  532.    while not Found and (X <= NumberOfElements (SkList))
  533.          if UpperCase(SkList[X]) = UserName
  534.             WriteBat ('RETURN > NUL')
  535.             WriteBat ('SWAPSK/N/G/D' + HomeDir + ' >NUL')
  536.             WriteBat ('SK')
  537.             WriteBat ('CLS')
  538.             Found = True
  539.          Endif
  540.          X = X + 1
  541.    EndWhile
  542. EndProc
  543.  
  544.